home *** CD-ROM | disk | FTP | other *** search
-
- ;------WRITE_HEX------------------------------
- ; Displays 4 hexadecimal numbers contained in AX
- ; Entry:
- ; AX ==> 4 Hex numbers
- ; Exit:
- ; All regs but AX restored
- ;----------------------------------------------
-
-
- Write_HEX PROC
- push bx ;Save regs
- push cx
- push dx
- mov bx, ax
- mov cx, 12
- shr ax, cl
- call pr_one_hex
- mov ax, bx
- mov cx, 8
- shr ax, cl
- call pr_one_hex
- mov ax, bx
- mov cx, 4
- shr ax, cl
- call pr_one_hex
- mov ax, bx
- call pr_one_hex
- pop dx
- pop cx
- pop bx
- ret
-
- pr_one_hex: and ax, 000Fh ;Mask LSD
- cmp ax,9
- ja wa20
- add ax, '0'
- jmp wa30
- wa20: add ax, 'A'-10
- wa30: mov dx, ax
- @doscall 02h ;Print the char
- ret
-
- Write_HEX ENDP